package com.mt.repair.entity.repairManagement;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.common.system.entity.User;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mt.repair.entity.repairManagement.Device;

@DEntity(label="设备用户关联表",comment="",moduleLabel="报修管理")
@Entity(name="repair_device_cat_user")
@Table(name = "repair_device_cat_user" , indexes = { @Index(name = "index_device_id", columnList = "device_id"),@Index(name = "index_user_id", columnList = "user_id")  })
@ApiModel(description = "设备用户关联表:")
public class DeviceCatUser extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="设备",foreignEntity="Device",comment="设备",component="对象选择",where=false)
	@ApiModelProperty(value = "设备:设备")
	@Column(name="device_id",length=255,nullable=true,unique=false)
	private Long deviceId;

	@Transient
	private Device device;

	@Transient
	@ApiModelProperty(value = "设备名称:设备")
	@DColumn(index=3,label="设备",foreignEntity="Device",comment="设备")
	private String deviceName;

	@DColumn(index=4,label="用户",foreignEntity="User",comment="用户",component="对象选择",where=false)
	@ApiModelProperty(value = "用户:用户")
	@Column(name="user_id",length=255,nullable=false,unique=false)
	private Long userId;

	@Transient
	private User user;

	@Transient
	@ApiModelProperty(value = "用户名称:用户")
	@DColumn(index=4,label="用户",foreignEntity="User",comment="用户")
	private String userName;

	@DColumn(index=5,label="管理过期时间",comment="过期时间，过期之后不再有管理权限",component="日期选择",where=false)
	@ApiModelProperty(value = "管理过期时间:过期时间，过期之后不再有管理权限")
	@Column(name="expiration_date",length=255,nullable=true,unique=false)
	@JsonSerialize(using = DateSerializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date expirationDate;


	public Long getDeviceId() {
		return this.deviceId;
	}

	public void setDeviceId(Long deviceId) {
		this.deviceId = deviceId;
	}

	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Date getExpirationDate() {
		return this.expirationDate;
	}

	public void setExpirationDate(Date expirationDate) {
		this.expirationDate = expirationDate;
	}

	public Device getDevice() {
		return this.device;
	}

	public void setDevice(Device device) {
		if(device == null){
		}
		else
		{
		this.deviceId = device.getEid();
		this.device = device;		
		}
}

	public String getDeviceName() {
		return this.deviceName;
	}

	public void setDeviceName(String deviceName) {
		this.deviceName = deviceName;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		if(user == null){
		}
		else
		{
		this.userId = user.getEid();
		this.user = user;		
		}
}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}



}
